Value object holding the result of some operation in a generic form which is suitable for outputting as JSON.


Properties

Name Returns Notes Example
nextHref String If an object was created this should be the href of that object. If the operation completed was part of a workflow then this should be the href of the next step in the workflow
messages List Any messages which are not specific to certain fields
fieldMessages List List of messages relating to specific fields. The field name must correspond to a POST variable name
data Object Any JSON friendly object

Methods

Name Returns Notes Example
dataAttribute ( key, value ) JsonResult Attempts to create a name/value pair in the data object. IF data is null it is created as a HashMap. If its already a Map, the key and value is added If it exists and is not a Map an exception is thrown
dataAttributes ( attributes ) JsonResult Calls dataAttribute for each entry in the provided Map. if the value is serializable it is added as is, otherwise is converted to a string
fieldMessage ( fieldName, message ) JsonResult Same as addFieldMessage but returns this to allow chaining
message ( message ) JsonResult Same as addMessage but returns this to allow chaining
addMessage ( s ) void Adds a mesage to the messags list
addFieldMessage ( field, message ) void Adds a FieldMessage to the field messages list
writeWithNiceDates ( out ) void Outputs Date as a long
write ( out ) void